home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 1998 November / IRIX 6.5.2 Base Documentation November 1998.img / usr / share / catman / u_man / cat1 / exstr.z / exstr
Text File  |  1998-10-20  |  16KB  |  265 lines

  1.  
  2.  
  3.  
  4. eeeexxxxssssttttrrrr((((1111))))                                                              eeeexxxxssssttttrrrr((((1111))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      _eeee_xxxx_ssss_tttt_rrrr - extract strings from source files
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      _eeee_xxxx_ssss_tttt_rrrr _f_i_l_e...
  13.      _eeee_xxxx_ssss_tttt_rrrr _----_eeee _f_i_l_e...
  14.      _eeee_xxxx_ssss_tttt_rrrr _----_rrrr [_----_dddd] _f_i_l_e...
  15.  
  16. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  17.      The _eeee_xxxx_ssss_tttt_rrrr utility is used to extract strings from C language source files
  18.      and replace them by calls to the message retrieval function [see
  19.      _gggg_eeee_tttt_tttt_xxxx_tttt(3C)].  This utility will extract all character strings surrounded
  20.      by double quotes, not just strings used as arguments to the _pppp_rrrr_iiii_nnnn_tttt_ffff
  21.      command or the _pppp_rrrr_iiii_nnnn_tttt_ffff routine.  In the first form, _eeee_xxxx_ssss_tttt_rrrr finds all
  22.      strings in the source files and writes them on the standard output.  Each
  23.      string is preceded by the source file name and a colon.  The meanings of
  24.      the options are:
  25.  
  26.      _----_eeee      Extract a list of strings from the named C language source files,
  27.              with positional information.  This list is produced on standard
  28.              output in the following format:
  29.  
  30.                  _f_i_l_e:_l_i_n_e:_p_o_s_i_t_i_o_n:_m_s_g_f_i_l_e:_m_s_g_n_u_m:_s_t_r_i_n_g
  31.  
  32.                  _f_i_l_e      the name of a C language source file
  33.                  _l_i_n_e      line number in the file
  34.                  _p_o_s_i_t_i_o_n  character position in the line
  35.                  _m_s_g_f_i_l_e   null
  36.                  _m_s_g_n_u_m    null
  37.                  _s_t_r_i_n_g    the extracted text string
  38.  
  39.              Normally you would redirect this output into a file.  Then you
  40.              would edit this file to add the values you want to use for
  41.              _m_s_g_f_i_l_e and _m_s_g_n_u_m:
  42.  
  43.                  _m_s_g_f_i_l_e   the file that contains the text strings that will
  44.                            replace _s_t_r_i_n_g.  A file with this name must be
  45.                            created and installed in the appropriate place by
  46.                            the _mmmm_kkkk_mmmm_ssss_gggg_ssss(1) utility.
  47.  
  48.                  _m_s_g_n_u_m    the sequence number of the string in _m_s_g_f_i_l_e.
  49.  
  50.              The next step is to use _eeee_xxxx_ssss_tttt_rrrr _----_rrrr to replace _s_t_r_i_n_gs in _f_i_l_e.
  51.  
  52.      _----_rrrr      Replace strings in a C language source file with function calls
  53.              to the message retrieval function _gggg_eeee_tttt_tttt_xxxx_tttt.
  54.  
  55.      _----_dddd      This option is used together with the _----_rrrr option.  If the message
  56.              retrieval fails when _gggg_eeee_tttt_tttt_xxxx_tttt is invoked at run time, then the
  57.              extracted string is printed.
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. eeeexxxxssssttttrrrr((((1111))))                                                              eeeexxxxssssttttrrrr((((1111))))
  71.  
  72.  
  73.  
  74.      You would use the capability provided by _eeee_xxxx_ssss_tttt_rrrr on an application program
  75.      that needs to run in an international environment and have messages print
  76.      in more than one language.  _eeee_xxxx_ssss_tttt_rrrr replaces text strings with function
  77.      calls that point at strings in a message database.  The database used
  78.      depends on the runtime value of the _LLLL_CCCC______MMMM_EEEE_SSSS_SSSS_AAAA_GGGG_EEEE_SSSS environment variable [see
  79.      _eeee_nnnn_vvvv_iiii_rrrr_oooo_nnnn(5)].
  80.  
  81.      The first step is to use _eeee_xxxx_ssss_tttt_rrrr _----_eeee to extract a list of strings and save
  82.      it in a file.  Next, examine this list and determine which strings can be
  83.      translated and subsequently retrieved by the message retrieval function.
  84.      Then, modify this file by deleting lines that can't be translated and,
  85.      for lines that can be translated, by adding the message file names and
  86.      the message numbers as the fourth (_m_s_g_f_i_l_e) and fifth (_m_s_g_n_u_m) entries on
  87.      a line.  The message files named must have been created by _mmmm_kkkk_mmmm_ssss_gggg_ssss(1) and
  88.      exist in _////_uuuu_ssss_rrrr_////_llll_iiii_bbbb_////_llll_oooo_cccc_aaaa_llll_eeee_////_l_o_c_a_l_e_////_LLLL_CCCC______MMMM_EEEE_SSSS_SSSS_AAAA_GGGG_EEEE_SSSS.  The directory _l_o_c_a_l_e
  89.      corresponds to the language in which the text strings are written [see
  90.      _ssss_eeee_tttt_llll_oooo_cccc_aaaa_llll_eeee(3C)].  The message numbers used must correspond to the sequence
  91.      numbers of strings in the message files.
  92.  
  93.      Now use this modified file as input to _eeee_xxxx_ssss_tttt_rrrr _----_rrrr to produce a new version
  94.      of the original C language source file in which the strings have been
  95.      replaced by calls to the message retrieval function _gggg_eeee_tttt_tttt_xxxx_tttt.  The _m_s_g_f_i_l_e
  96.      and _m_s_g_n_u_m fields are used to construct the first argument to _gggg_eeee_tttt_tttt_xxxx_tttt.
  97.      The second argument to _gggg_eeee_tttt_tttt_xxxx_tttt is printed if the message retrieval fails
  98.      at run time.  This argument is the null string, unless the _----_dddd option is
  99.      used.
  100.  
  101.      This utility cannot replace strings in all instances. For example, a
  102.      static initialized character string cannot be replaced by a function
  103.      call, or a string could be in the form of an escape sequence that cannot
  104.      be translated.  In order not to break existing code, the files created by
  105.      invoking _eeee_xxxx_ssss_tttt_rrrr _----_eeee must be examined and lines containing strings not
  106.      replaceable by function calls must be deleted. In some cases the code may
  107.      require modifications so that strings can be extracted and replaced by
  108.      calls to the message retrieval function.
  109.  
  110. EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS
  111.      The following examples show uses of _eeee_xxxx_ssss_tttt_rrrr.
  112.  
  113.      Assume that the file _ffff_oooo_oooo_...._cccc contains two strings:
  114.  
  115.           _mmmm_aaaa_iiii_nnnn_((((_))))
  116.           _{{{{
  117.                _pppp_rrrr_iiii_nnnn_tttt_ffff_((((_""""_TTTT_hhhh_iiii_ssss _iiii_ssss _aaaa_nnnn _eeee_xxxx_aaaa_mmmm_pppp_llll_eeee_\\\\_nnnn_""""_))))_;;;;
  118.                _pppp_rrrr_iiii_nnnn_tttt_ffff_((((_""""_HHHH_eeee_llll_llll_oooo _wwww_oooo_rrrr_llll_dddd_!!!!_\\\\_nnnn_""""_))))_;;;;
  119.           _}}}}
  120.  
  121.      The _eeee_xxxx_ssss_tttt_rrrr utility, invoked with the argument _ffff_oooo_oooo_...._cccc, extracts strings from
  122.      the named file and prints them on the standard output.
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. eeeexxxxssssttttrrrr((((1111))))                                                              eeeexxxxssssttttrrrr((((1111))))
  137.  
  138.  
  139.  
  140.      _eeee_xxxx_ssss_tttt_rrrr _ffff_oooo_oooo_...._cccc produces the following output:
  141.  
  142.           _ffff_oooo_oooo_...._cccc_::::_TTTT_hhhh_iiii_ssss _iiii_ssss _aaaa_nnnn _eeee_xxxx_aaaa_mmmm_pppp_llll_eeee_\\\\_nnnn
  143.           _ffff_oooo_oooo_...._cccc_::::_HHHH_eeee_llll_llll_oooo _wwww_oooo_rrrr_llll_dddd_!!!!_\\\\_nnnn
  144.  
  145.      _eeee_xxxx_ssss_tttt_rrrr _----_eeee _ffff_oooo_oooo_...._cccc _>>>> _ffff_oooo_oooo_...._ssss_tttt_rrrr_iiii_nnnn_gggg_ssss_oooo_uuuu_tttt produces the following output in the file
  146.      _ffff_oooo_oooo_...._ssss_tttt_rrrr_iiii_nnnn_gggg_ssss_oooo_uuuu_tttt:
  147.  
  148.           _ffff_oooo_oooo_...._cccc_::::_3333_::::_8888_::::_::::_::::_TTTT_hhhh_iiii_ssss _iiii_ssss _aaaa_nnnn _eeee_xxxx_aaaa_mmmm_pppp_llll_eeee_\\\\_nnnn
  149.           _ffff_oooo_oooo_...._cccc_::::_4444_::::_8888_::::_::::_::::_HHHH_eeee_llll_llll_oooo _wwww_oooo_rrrr_llll_dddd_!!!!_\\\\_nnnn
  150.  
  151.      You must edit _ffff_oooo_oooo_...._ssss_tttt_rrrr_iiii_nnnn_gggg_ssss_oooo_uuuu_tttt to add the values you want to use for the
  152.      _m_s_g_f_i_l_e and _m_s_g_n_u_m fields before these strings can be replaced by calls
  153.      to the retrieval function.  If _UUUU_XXXX is the name of the message file, and
  154.      the numbers _1111 and _2222 represent the sequence number of the strings in the
  155.      file, here is what _ffff_oooo_oooo_...._ssss_tttt_rrrr_iiii_nnnn_gggg_ssss_oooo_uuuu_tttt looks like after you add this
  156.      information:
  157.  
  158.           _ffff_oooo_oooo_...._cccc_::::_3333_::::_8888_::::_UUUU_XXXX_::::_1111_::::_TTTT_hhhh_iiii_ssss _iiii_ssss _aaaa_nnnn _eeee_xxxx_aaaa_mmmm_pppp_llll_eeee_\\\\_nnnn
  159.           _ffff_oooo_oooo_...._cccc_::::_4444_::::_8888_::::_UUUU_XXXX_::::_2222_::::_HHHH_eeee_llll_llll_oooo _wwww_oooo_rrrr_llll_dddd_!!!!_\\\\_nnnn
  160.  
  161.      The _eeee_xxxx_ssss_tttt_rrrr utility can now be invoked with the _----_rrrr option to replace the
  162.      strings in the source file by calls to the message retrieval function
  163.      _gggg_eeee_tttt_tttt_xxxx_tttt.
  164.  
  165.      _eeee_xxxx_ssss_tttt_rrrr _----_rrrr _ffff_oooo_oooo_...._cccc _<<<<_ffff_oooo_oooo_...._ssss_tttt_rrrr_iiii_nnnn_gggg_ssss_oooo_uuuu_tttt _>>>>_iiii_nnnn_tttt_llll_ffff_oooo_oooo_...._cccc produces the following output:
  166.  
  167.           _eeee_xxxx_tttt_eeee_rrrr_nnnn _cccc_hhhh_aaaa_rrrr _****_gggg_eeee_tttt_tttt_xxxx_tttt_((((_))))_;;;;
  168.           _mmmm_aaaa_iiii_nnnn_((((_))))
  169.           _{{{{
  170.                _pppp_rrrr_iiii_nnnn_tttt_ffff_((((_gggg_eeee_tttt_tttt_xxxx_tttt_((((_""""_UUUU_XXXX_::::_1111_""""_,,,, _""""_""""_))))_))))_;;;;
  171.                _pppp_rrrr_iiii_nnnn_tttt_ffff_((((_gggg_eeee_tttt_tttt_xxxx_tttt_((((_""""_UUUU_XXXX_::::_2222_""""_,,,, _""""_""""_))))_))))_;;;;
  172.           _}}}}
  173.  
  174.      _eeee_xxxx_ssss_tttt_rrrr _----_rrrr_dddd _ffff_oooo_oooo_...._cccc _<<<<_ffff_oooo_oooo_...._ssss_tttt_rrrr_iiii_nnnn_gggg_ssss_oooo_uuuu_tttt _>>>>_iiii_nnnn_tttt_llll_ffff_oooo_oooo_...._cccc uses the extracted strings as
  175.      a second argument to _gggg_eeee_tttt_tttt_xxxx_tttt.
  176.  
  177.           _eeee_xxxx_tttt_eeee_rrrr_nnnn _cccc_hhhh_aaaa_rrrr _****_gggg_eeee_tttt_tttt_xxxx_tttt_((((_))))_;;;;
  178.           _mmmm_aaaa_iiii_nnnn_((((_))))
  179.           _{{{{
  180.                _pppp_rrrr_iiii_nnnn_tttt_ffff_((((_gggg_eeee_tttt_tttt_xxxx_tttt_((((_""""_UUUU_XXXX_::::_1111_""""_,,,, _""""_TTTT_hhhh_iiii_ssss _iiii_ssss _aaaa_nnnn _eeee_xxxx_aaaa_mmmm_pppp_llll_eeee_\\\\_nnnn_""""_))))_))))_;;;;
  181.                _pppp_rrrr_iiii_nnnn_tttt_ffff_((((_gggg_eeee_tttt_tttt_xxxx_tttt_((((_""""_UUUU_XXXX_::::_2222_""""_,,,, _""""_HHHH_eeee_llll_llll_oooo _wwww_oooo_rrrr_llll_dddd_!!!!_\\\\_nnnn_""""_))))_))))_;;;;
  182.           _}}}}
  183.  
  184. FFFFIIIILLLLEEEESSSS
  185.      _////_uuuu_ssss_rrrr_////_llll_iiii_bbbb_////_llll_oooo_cccc_aaaa_llll_eeee_////_l_o_c_a_l_e_////_LLLL_CCCC______MMMM_EEEE_SSSS_SSSS_AAAA_GGGG_EEEE_SSSS_////_****
  186.                               files created by _mmmm_kkkk_mmmm_ssss_gggg_ssss(1)
  187.  
  188. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  189.      _gggg_eeee_tttt_tttt_xxxx_tttt(1), _mmmm_kkkk_mmmm_ssss_gggg_ssss(1), _pppp_rrrr_iiii_nnnn_tttt_ffff(1), _ssss_rrrr_cccc_hhhh_tttt_xxxx_tttt(1), _gggg_eeee_tttt_tttt_xxxx_tttt(3C), _pppp_rrrr_iiii_nnnn_tttt_ffff(3S),
  190.      _ssss_eeee_tttt_llll_oooo_cccc_aaaa_llll_eeee(3C), _eeee_nnnn_vvvv_iiii_rrrr_oooo_nnnn(5).
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. eeeexxxxssssttttrrrr((((1111))))                                                              eeeexxxxssssttttrrrr((((1111))))
  203.  
  204.  
  205.  
  206. DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
  207.      The error messages produced by _eeee_xxxx_ssss_tttt_rrrr are intended to be self-explanatory.
  208.      They indicate errors in the command line or format errors encountered
  209.      within the input file.
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.                                                                         PPPPaaaaggggeeee 4444
  262.  
  263.  
  264.  
  265.